<?php
/**
 * Create new user
 * สร้าง user ใหม่
 * @package Member
 * @subpackage View
 * @category view
 */
require('right_bar.php');
$x['AddTitle'] .= $this->lang->line('mem.50.createuser');

/* Load CSS */
$tmp = array('a:c:validationEngine.jquery', 'a:c:form_signup','a:c:table-style');
$x['AddHead'] .= $this->bee->AddCss($tmp);
unset($tmp);
// Load CSS
/* Load JavaScript */
$tmp = array('a:j:jquery.validationEngine-en', 'a:j:jquery.validationEngine');
$bf['AddFoot'] .= $this->bee->AddJava($tmp);
unset($tmp);
// Load JavaScript

$x['AddCss'] .= '';
$bf['AddHeadJquery'] .= '
     $(".form_blue").validationEngine();
     ';

$x['headlink'] = $this->lang->line('mem.50.createuser');

$this->admin->view('_head', $x);
unset($x);
?>
<div id="rightnow">
    <h3 class="reallynow">
        <span><?php echo $this->lang->line("mem.50.createuser");?></span>
        
        <br />
    </h3>
    <p><?php echo $this->lang->line('mem.51.createdetail');?></p>
    <?php
if ($use_username) {
	$username = array(
		'name'	=> 'username',
		'id'	=> 'username',
		'value' => set_value('username'),
		'maxlength'	=> $this->config->item('username_max_length', 'tank_auth'),
                'class' => 'validate[required,length['.$this->config->item('username_min_length','tank_auth').','.$this->config->item('username_max_length','tank_auth').']]',
		'size'	=> 30,
	);
}
$email = array(
	'name'	=> 'email',
	'id'	=> 'email',
	'value'	=> set_value('email'),
	'maxlength'	=> 80,
    'class' => 'validate[custom[email],required]',
	'size'	=> 30,
);
$password = array(
	'name'	=> 'password',
	'id'	=> 'password',
	'value' => set_value('password'),
	'maxlength'	=> $this->config->item('password_max_length', 'tank_auth'),
    'class' => 'validate[required,length['.$this->config->item('password_min_length','tank_auth').','.$this->config->item('password_max_length','tank_auth').']]',
	'size'	=> 30,
);
$confirm_password = array(
	'name'	=> 'confirm_password',
	'id'	=> 'confirm_password',
	'value' => set_value('confirm_password'),
	'maxlength'	=> $this->config->item('password_max_length', 'tank_auth'),
    'class' => 'validate[confirm[password],required]',
	'size'	=> 30,
);
$captcha = array(
	'name'	=> 'captcha',
	'id'	=> 'captcha',
    'class' => 'validate[required]',
	'maxlength'	=> 8,
);
?>
<?php echo form_open($this->uri->uri_string(),'class="form_blue"'); ?>
<table>
	<?php if ($use_username) { ?>
	<tr>
		<td><?php echo form_label('Username', $username['id']); ?></td>
		<td><?php echo form_input($username); ?></td>
		<td style="color: red;"><?php echo form_error($username['name']); ?><?php echo isset($errors[$username['name']])?$errors[$username['name']]:''; ?></td>
	</tr>
	<?php } ?>
	<tr>
		<td><?php echo form_label('Email Address', $email['id']); ?></td>
		<td><?php echo form_input($email); ?></td>
		<td style="color: red;"><?php echo form_error($email['name']); ?><?php echo isset($errors[$email['name']])?$errors[$email['name']]:''; ?></td>
	</tr>
	<tr>
		<td><?php echo form_label('Password', $password['id']); ?></td>
		<td><?php echo form_password($password); ?></td>
		<td style="color: red;"><?php echo form_error($password['name']); ?></td>
	</tr>
	<tr>
		<td><?php echo form_label('Confirm Password', $confirm_password['id']); ?></td>
		<td><?php echo form_password($confirm_password); ?></td>
		<td style="color: red;"><?php echo form_error($confirm_password['name']); ?></td>
	</tr>

	<?php if ($captcha_registration) {
		if ($use_recaptcha) { ?>
	<tr>
		<td colspan="2">
			<div id="recaptcha_image"></div>
		</td>
		<td>
			<a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a>
			<div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div>
			<div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div>
		</td>
	</tr>
	<tr>
		<td>
			<div class="recaptcha_only_if_image">Enter the words above</div>
			<div class="recaptcha_only_if_audio">Enter the numbers you hear</div>
		</td>
		<td><input type="text" id="recaptcha_response_field" name="recaptcha_response_field" /></td>
		<td style="color: red;"><?php echo form_error('recaptcha_response_field'); ?></td>
		<?php echo $recaptcha_html; ?>
	</tr>
	<?php } else { ?>
	<tr>
		<td colspan="3">
			<p>Enter the code exactly as it appears:</p>
			<?php echo $captcha_html; ?>
		</td>
	</tr>
	<tr>
		<td><?php echo form_label('Confirmation Code', $captcha['id']); ?></td>
		<td><?php echo form_input($captcha); ?></td>
		<td style="color: red;"><?php echo form_error($captcha['name']); ?></td>
	</tr>
	<?php }
	} ?>
</table>
<?php echo form_submit('register', 'Register'); ?>
<?php echo form_close(); ?>
    

</div>

<?php
$this->admin->view('_foot', $bf);
unset($bf);
?>